package vn.ugame.model.entity;


import java.util.Locale;

@Entity
public class Module{
    
    @Collumn(name="moduleId")
    private String id;
    @Collumn(name="defaultName")
    private String defaultName;
    @Collumn(name="moduleName")
    private String name;
    @Collumn(name="moduleText")
    private String text;
    @Collumn(name="locale")
    private Locale locale;
    @Collumn(name="moduleType")
    private int type;
    @Collumn(name="root")
    private boolean root;
    @Collumn(name="moduleEnable")
    private boolean enable;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Locale getLocale() {
        return locale;
    }

    public void setLocale(Locale locale) {
        this.locale = locale;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }    

    public boolean isRoot() {
        return root;
    }

    public void setRoot(boolean root) {
        this.root = root;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public String getDefaultName() {
        return defaultName;
    }

    public void setDefaultName(String defaultName) {
        this.defaultName = defaultName;
    }

    public Module() {
    }

    public Module(String id, String name, String text, Locale locale, int type, boolean root, boolean enable) {
        this.id = id;
        this.name = name;
        this.text = text;
        this.locale = locale;
        this.type = type;
        this.root = root;
        this.enable = enable;
    }  

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof Module){
            Module m = (Module) obj;
            if(m.getName().equalsIgnoreCase(this.getName())){
                return true;
            }
        }
        return false;
    }

    @Override
    public int hashCode() {
        return name.hashCode();
    }  
    
}
